package cn.iocoder.yudao.module.pay.bank.dal.mysql;

import cn.iocoder.yudao.framework.business.basic.dao.mapper.CoreMapper;
import cn.iocoder.yudao.framework.business.basic.dao.query.CoreLambdaQueryWrapper;
import cn.iocoder.yudao.framework.common.pojo.PageResult;
import cn.iocoder.yudao.module.pay.bank.dal.dataobject.PayBankDO;
import cn.iocoder.yudao.module.pay.bank.vo.PayBankPageReqVO;
import org.apache.ibatis.annotations.Mapper;

/**
 * 银行卡 Mapper
 *
 * @author 山野羡民
 */
@Mapper
public interface PayBankMapper extends CoreMapper<PayBankDO> {

    default PageResult<PayBankDO> selectPage(PayBankPageReqVO reqVO) {
        return selectPage(reqVO, new CoreLambdaQueryWrapper<PayBankDO>()
                .eqIfPresent(PayBankDO::getUserId, reqVO.getUserId())
                .likeIfPresent(PayBankDO::getRealName, reqVO.getRealName())
                .eqIfPresent(PayBankDO::getCardType, reqVO.getCardType())
                .eqIfPresent(PayBankDO::getCardNo, reqVO.getCardNo())
                .eqIfPresent(PayBankDO::getCardCode, reqVO.getCardCode())
                .likeIfPresent(PayBankDO::getCardName, reqVO.getCardName())
                .eqIfPresent(PayBankDO::getStatus, reqVO.getStatus())
                .eqIfPresent(PayBankDO::getIsDefault, reqVO.getIsDefault())
                .betweenIfPresent(PayBankDO::getCreateTime, reqVO.getCreateTime())
                .orderByDesc(PayBankDO::getId));
    }

}
